<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * File filter form base class.
 *
 * @package    FinalsClub
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 13459 2008-11-28 14:48:12Z fabien $
 */
class BaseFileFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'             => new sfWidgetFormFilterInput(),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'annotate_date'    => new sfWidgetFormFilterInput(),
      'size'             => new sfWidgetFormFilterInput(),
      'description'      => new sfWidgetFormFilterInput(),
      'code'             => new sfWidgetFormFilterInput(),
      'link'             => new sfWidgetFormFilterInput(),
      'tags'             => new sfWidgetFormFilterInput(),
      'view_count'       => new sfWidgetFormFilterInput(),
      'download_count'   => new sfWidgetFormFilterInput(),
      'owner_id'         => new sfWidgetFormPropelChoice(array('model' => 'User', 'add_empty' => true)),
      'thumbnail'        => new sfWidgetFormFilterInput(),
      'group_id'         => new sfWidgetFormPropelChoice(array('model' => 'Group', 'add_empty' => true)),
      'network_id'       => new sfWidgetFormFilterInput(),
      'course_id'        => new sfWidgetFormFilterInput(),
      'permission_level' => new sfWidgetFormFilterInput(),
      'category'         => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'name'             => new sfValidatorPass(array('required' => false)),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'annotate_date'    => new sfValidatorPass(array('required' => false)),
      'size'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'description'      => new sfValidatorPass(array('required' => false)),
      'code'             => new sfValidatorPass(array('required' => false)),
      'link'             => new sfValidatorPass(array('required' => false)),
      'tags'             => new sfValidatorPass(array('required' => false)),
      'view_count'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'download_count'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'owner_id'         => new sfValidatorPropelChoice(array('required' => false, 'model' => 'User', 'column' => 'id')),
      'thumbnail'        => new sfValidatorPass(array('required' => false)),
      'group_id'         => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Group', 'column' => 'id')),
      'network_id'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'course_id'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'permission_level' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'category'         => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('file_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'File';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'name'             => 'Text',
      'created_at'       => 'Date',
      'annotate_date'    => 'Text',
      'size'             => 'Number',
      'description'      => 'Text',
      'code'             => 'Text',
      'link'             => 'Text',
      'tags'             => 'Text',
      'view_count'       => 'Number',
      'download_count'   => 'Number',
      'owner_id'         => 'ForeignKey',
      'thumbnail'        => 'Text',
      'group_id'         => 'ForeignKey',
      'network_id'       => 'Number',
      'course_id'        => 'Number',
      'permission_level' => 'Number',
      'category'         => 'Text',
    );
  }
}
